package com.example.user.controller.user;

import com.example.api.domain.vo.UserQuestionResultVO;
import com.example.common.core.controller.BaseController;
import com.example.common.core.domain.R;
import com.example.user.domain.user.dto.UserSubmitDTO;
import com.example.user.service.user.UserQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/question")
public class UserQuestionController extends BaseController {
    @Autowired
    private UserQuestionService userQuestionService;
    @PostMapping("/submit")
    public R<R<UserQuestionResultVO>> submit(@RequestBody UserSubmitDTO userSubmitDTO) {
        return R.ok(userQuestionService.submit(userSubmitDTO));
    }

    @PostMapping("/rabbit/submit")
    public R<Void> rabbitSubmit(@RequestBody UserSubmitDTO submitDTO) {
        return toR(userQuestionService.rabbitSubmit(submitDTO));
    }

    @GetMapping("/exe/result")
    public  R<UserQuestionResultVO> exeResult(Long contestId, Long questionId, String currentTime) {
        return R.ok(userQuestionService.exeResult(contestId, questionId, currentTime));
    }
}
